package com.hmis;

import com.hmis.starter.MainUI;
import javafx.application.Application;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Slf4j
@SpringBootApplication
@EnableTransactionManagement
@MapperScan("com/hmis/mapper")
public class HmisApplication extends Application {

    public static ConfigurableApplicationContext applicationContext;

    private static String[] args;

    public static void main(String[] args) {

        HmisApplication.args = args;
        launch(args);

    }

    @Override
    public void init() throws Exception {
        applicationContext = SpringApplication.run(HmisApplication.class, args);
    }

    @Override
    public void stop() throws Exception {
        applicationContext.stop();
    }

    @Override
    public void start(Stage stage) throws Exception {

        stage = MainUI.MainUI().getStage();
        //设置标题
        stage.setTitle("住院管理系统");
        //设置图标
        stage.getIcons().add(new Image("hospital.jpg"));
        stage.setResizable(false);
        stage.show();
        log.info("执行成功");

    }


}
